﻿<!--
 * Copyright (c) 2010, Andriy Syrov
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification, are permitted provided 
 * that the following conditions are met:
 * 
 * Redistributions of source code must retain the above copyright notice, this list of conditions and the 
 * following disclaimer.
 * 
 * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and 
 * the following disclaimer in the documentation and/or other materials provided with the distribution.
 *
 * Neither the name of Andriy Syrov nor the names of his contributors may be used to endorse or promote 
 * products derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED 
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A 
 * PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY 
 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED 
 * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 
 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 
 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 *   
 -->

<ResourceDictionary
    xmlns:local="clr-namespace:ColorWheel.Controls"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    mc:Ignorable="d">
  
    <Style
        TargetType="local:ColorComponentSlider">

        <Setter
            Property="Background"
            Value="Black" />

        <Setter
            Property="BorderBrush"
            Value="White" />

        <Setter
            Property="BorderThickness"
            Value="1" />

        <Setter
            Property="Maximum"
            Value="255" />

        <Setter
            Property="Minimum"
            Value="0" />

        <Setter
            Property="Value"
            Value="0" />

        <Setter
            Property="IsTabStop"
            Value="False" />

        <Setter
            Property="Template">
            <Setter.Value>

                <ControlTemplate
                    TargetType="Slider">

                    <Grid
                        Background="Transparent"
                        x:Name="Root">

                        <Grid.Resources>
                            <ControlTemplate
                                x:Key="RepeatButtonTemplate">
                                <Grid
                                    x:Name="Root"
                                    Background="Transparent"
                                    Opacity="0" />
                            </ControlTemplate>

                            <ControlTemplate
                                x:Key="HorizontalThumbTemplate">

                                <Path
                                    Data="M 1,10 11,10 6,0 Z"
                                    Stroke="{TemplateBinding BorderBrush}"
                                    StrokeThickness="{TemplateBinding BorderThickness}"
                                    Fill="{TemplateBinding Background}" />

                            </ControlTemplate>

                            <ControlTemplate
                                x:Key="VerticalThumbTemplate">

                                <Path
                                    Data="M 0,5 10,10 10,0 Z"
                                    Stroke="{TemplateBinding BorderBrush}"
                                    StrokeThickness="{TemplateBinding BorderThickness}"
                                    Fill="{TemplateBinding Background}" />

                            </ControlTemplate>
                        </Grid.Resources>

                        <VisualStateManager.VisualStateGroups>
                            <VisualStateGroup
                                x:Name="CommonStates">
                                <VisualState
                                    x:Name="Normal" />
                                <VisualState
                                    x:Name="MouseOver" />
                                <VisualState
                                    x:Name="Disabled" />
                            </VisualStateGroup>
                        </VisualStateManager.VisualStateGroups>

                        <Grid
                            x:Name="HorizontalTemplate">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    Width="Auto" />

                                <ColumnDefinition
                                    Width="Auto" />

                                <ColumnDefinition
                                    Width="*" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="*"></RowDefinition>

                                <RowDefinition
                                    Height="12"></RowDefinition>
                            </Grid.RowDefinitions>

                            <Border
                                Background="Transparent"
                                Grid.Row="0"
                                Grid.Column="0"
                                Grid.ColumnSpan="3"
                                x:Name="HorizontalTrackRectangle"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Margin="5, 0, 5, 0"
                                CornerRadius="1"
                                BorderBrush="White"
                                BorderThickness="1">

                            </Border>

                            <RepeatButton
                                Grid.Row="0"
                                x:Name="HorizontalTrackLargeChangeDecreaseRepeatButton"
                                Grid.Column="0"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                IsTabStop="False"
                                Template="{StaticResource RepeatButtonTemplate}" />

                            <Thumb
                                Cursor="Hand"
                                Grid.Row="1"
                                Grid.Column="1"
                                x:Name="HorizontalThumb"
                                IsTabStop="True"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Template="{StaticResource HorizontalThumbTemplate}"
                                Height="12"
                                Width="12">
                            </Thumb>

                            <RepeatButton
                                Grid.Row="0"
                                x:Name="HorizontalTrackLargeChangeIncreaseRepeatButton"
                                Grid.Column="2"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                IsTabStop="False"
                                Template="{StaticResource RepeatButtonTemplate}" />

                        </Grid>

                        <Grid
                            x:Name="VerticalTemplate"
                            Background="Transparent"
                            Visibility="Collapsed">

                            <Grid.ColumnDefinitions>
                                <ColumnDefinition
                                    Width="*" />

                                <ColumnDefinition
                                    Width="12" />
                            </Grid.ColumnDefinitions>

                            <Grid.RowDefinitions>
                                <RowDefinition
                                    Height="*" />

                                <RowDefinition
                                    Height="Auto" />

                                <RowDefinition
                                    Height="Auto" />

                            </Grid.RowDefinitions>

                            <Border
                                Grid.Row="0"
                                Grid.RowSpan="3"
                                x:Name="VerticalTrackRectangle"
                                Grid.Column="0"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Margin="0, 5, 0, 5"
                                CornerRadius="1"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                BorderThickness="1">
                            </Border>

                            <RepeatButton
                                x:Name="VerticalTrackLargeChangeDecreaseRepeatButton"
                                IsTabStop="False"
                                Grid.Row="2"
                                Grid.Column="0"
                                Template="{StaticResource RepeatButtonTemplate}"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch" />

                            <Thumb
                                Cursor="Hand"
                                x:Name="VerticalThumb"
                                Height="12"
                                IsTabStop="True"
                                Grid.Row="1"
                                Grid.Column="1"
                                Background="{TemplateBinding Background}"
                                BorderBrush="{TemplateBinding BorderBrush}"
                                Template="{StaticResource VerticalThumbTemplate}"
                                Width="12" />

                            <RepeatButton
                                x:Name="VerticalTrackLargeChangeIncreaseRepeatButton"
                                IsTabStop="False"
                                Grid.Column="0"
                                Grid.Row="0"
                                VerticalAlignment="Stretch"
                                HorizontalAlignment="Stretch"
                                Template="{StaticResource RepeatButtonTemplate}" />
                        </Grid>
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>

</ResourceDictionary>
